/*
* 复杂的对象类型推断
* 使用 ? 作为可选参数
* */
var __assign = (this && this.__assign) || function () {
    __assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};
function showObj(obj) {
    var _a;
    var result = "".concat(obj.name, " \u7684 id \u662F ").concat(obj.id, " \uFF0C\u6700\u559C\u6B22\u7684\u6C34\u679C\u662F\uFF1A");
    var list = '';
    for (var _i = 0, _b = obj.fruits; _i < _b.length; _i++) {
        var fruit = _b[_i];
        list += "\u540D\u79F0 ".concat(fruit.name, "\uFF0C\u989C\u8272 ").concat(fruit.color);
    }
    console.log(result + list);
    if (obj.girlFriend) {
        console.log("补充，女朋友是", (_a = obj.girlFriend) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase());
    }
}
var user = {
    id: 7,
    name: "罗俊华",
    fruits: [
        {
            name: "菠萝",
            color: "黄色"
        }, {
            name: "葡萄",
            color: "紫色"
        }
    ]
};
showObj(user);
showObj(__assign(__assign({}, user), { girlFriend: "高仔AA" }));
function showUserInfo(simpleUser) {
    console.log(simpleUser.name, simpleUser.age, simpleUser.fruits);
}
showUserInfo({ name: "罗俊华", fruits: ['苹果', '香蕉'] });
